import axios from 'axios';

const http = axios.create({
    baseURL: '/api',
    timeout: 5000

})

// 请求和响应拦截器
http.interceptors.request.use(config => {
    let token = sessionStorage.getItem('token')
    if (token) {
        config.headers['token'] = token;
    }
    return config;
})

// 响应拦截器
http.interceptors.response.use(res => {
    console.log("请求成功");

    return res.data;
})


export default http